<?php
	/*
		PandaForum: PHP Forum Engine
		
		Jesse Gill, 0108377707
	*/
	
	require_once('./src/classes/Page.php');
	
	$page = new Page('Register');
	
	$page->print_header();
?>
	<link href='src/css/register.css' rel='stylesheet' type='text/css' />
	
	<h1 class="pageheading">Register Account</h1><br />
	
	<form id="register_form" name='registerForm' method='post' action='javascript:ajax_register();'>
		<table>
			<tr>
				<td>Username:</td>
				<td><input type="text" name="username" /></td>
			</tr>
			
			<tr>
				<td>Password:</td>
				<td><input type="password" name="password" /></td>
			</tr>
			
			<tr>
				<td>Retype Password:</td>
				<td><input type="password" name="retypepassword" /></td>
			</tr>
			
			<tr>
				<td>Email Address:</td>
				<td><input type="text" name="email" /></td>
			</tr>
			
			<tr>
				<td>Birthdate:</td>
				<td><?php getBirthdaySelect(); ?></td>
			</tr>
			
			<tr>
				<td><input type="submit" value="Register" /></td>
				<td></td>
			</tr>
		</table>
	</form>
	
	<div id="register_response_area"></div>
	
<?php
	$page->print_footer();
	
	// Generate birthday selection boxes
	function getBirthdaySelect()
	{
		echo "
				<select name=\"day\" size=\"1\">
		";
		
		echo "<option value='Day' selected='selected'>Day</option>";
		for ($d = 1; $d <= 31; $d++)
		{
			echo "<option value='$d'>$d</option>";
		}
		
		echo "
				</select>
				
				<select name=\"month\" size=\"1\">
		";
		
		echo "<option value='Month' selected='selected'>Month</option>";
		for ($m = 1; $m <= 12; $m++)
		{
			echo "<option value='$m'>$m</option>";
		}
		
		echo "
				</select>
				
				<select name=\"year\" size=\"1\">
		";
		
		echo "<option value='Year' selected='selected'>Year</option>";
		for ($y = (intval(date("Y")) - 100); $y <= intval(date("Y")); $y++)
		{
			echo "<option value='$y'>$y</option>";
		}
		
		echo "
				</select>
		";
	}
?>